package com.topscomm.meet.utils;

import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class GeneratePPTTemplateUtil extends  BaseTemplateUtil{

    /**
     * @description: ppt转pdf
     * @param filePath
     * @param targetPath
     * @return
     * @throws Exception
     * @author: wanghongwei
     * @date: 2021-3-19 11:27:04
     * @modify:
     */
    public static void convertToPdf(String srcPPTPath, String destPdfPath)throws IOException {
        // 验证License 若不验证则转化出的pdf文档会有水印产生

        try (FileOutputStream fileOs = new FileOutputStream(new File(destPdfPath))) {
            Presentation presentation = new Presentation(srcPPTPath);
            presentation.save(fileOs, SaveFormat.Pdf);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
